module ExtensionRails2
  def self.included(base)
    base.class_eval do
#      named_scope :where,    lambda { |conditions| { :conditions => conditions.reject { |k, v| v.blank? } } }
#      named_scope :joins,    lambda { |joins| { :joins => joins } }
#      named_scope :includes, lambda { |includes| { :include => includes } }
#      named_scope :selects,  lambda { |selects| { :select => selects } }
#      named_scope :order,    lambda { |order| { :order => order } }
#      named_scope :limit,    lambda { |limit| { :limit => limit } }
#      named_scope :offset,   lambda { |offset| { :offset => offset } }
#      named_scope :group,    lambda { |group| { :group => group } }
#      named_scope :having,   lambda { |having| { :having => having } }
    
      scope :deleted, :conditions => { :status => -1 }
      scope :active, :conditions => "status >= 0"
     
      def active?
        if self.respond_to? :status
          return self.status >= 0
        end
        false
      end
      
      def deleted?
        if self.respond_to? :status
          return self.status == -1
        end
        false
      end
    end
  end
end

ActiveRecord::Base.send(:include, ExtensionRails2)

ActionView::Base.field_error_proc = Proc.new{ |html_tag, instance| "<span class=\"fieldWithErrors\">#{html_tag}</span>" }
